package com.zzg.search.common;

import java.util.Map;

import org.elasticsearch.action.delete.DeleteResponse;
import org.elasticsearch.action.get.GetResponse;
import org.elasticsearch.action.index.IndexResponse;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.action.update.UpdateResponse;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.index.query.BoolQueryBuilder;
/**
 * elasticsearch 公共接口
 * @author zzg
 *
 */
public interface BaseSearchService {
	/**
	 * 简单查询
	 * @param index 
	 * @param type
	 * @param id
	 * @return
	 */
	GetResponse select(String index, String type, String id);

	/**
	 * 新增接口
	 * @param index
	 * @param type
	 * @param builder
	 * @return
	 */
	IndexResponse insert(String index, String type, XContentBuilder builder);
	
	/**
	 * 删除接口
	 * @param index
	 * @param type
	 * @param id
	 * @return
	 */
	DeleteResponse  delete(String index, String type, String id);
	
	/**
	 * 更新接口
	 * @param index
	 * @param type
	 * @param id
	 * @param builder
	 * @param parames
	 */
	UpdateResponse  update(String index, String type, String id, XContentBuilder builder, Map<String,Object> parames);
	
	/**
	 * 多条件查询
	 * @param index
	 * @param type
	 * @param builder
	 * @param args
	 */
	SearchResponse multiQuery(String keyword, String type, BoolQueryBuilder builder, Map<String,Object> must, Map<String,Object[]> rang);
	
	
	
}
